<?php
/* @var $this SuratMasukController */
/* @var $model SuratMasuk */

$this->breadcrumbs=array(
	'Surat Masuk'
);


Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('surat-masuk-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>

<?php $this->widget('ext.widgets.grid.AxGridView', array(
	'id'=>'surat-masuk-grid',
	'dataProvider'=>$model->search($by),
        'deleteTopButton' => ($by==NULL) ? TRUE : FALSE,
        'createTopButton' => ($by==NULL) ? TRUE : FALSE,
	//'filter'=>$model,
	'columns'=>array(
		'no_surat',
                array(
                    'header' => 'Nama Pengirim',
                    'value' => '$data->Instansi->nama'
                ),
                array(
                    'name' => 'Pegawai.nama',
                    'header' => 'Nama Penerima',
                    'value' => '$data->Pegawai->nama." (".$data->Pegawai->Jabatan->StrukturOrganisasi->nama.")"'
                ),
		'info_penyimpanan',
		'tanggal_masuk',
		'tanggal_diterima',
		array(
			'class'=>'CButtonColumn',
                        'template' => ($by==NULL) ? '{view} {update} {delete}': '{view}',
                        'headerHtmlOptions' => array('class' => 'lastcolumn'),
                        'htmlOptions' => array('class' => 'lastcolumn')
		),
	),
)); ?>